package com.earthea.common.system.server;

import com.earthea.common.util.IpUtils;
import lombok.Getter;

import java.util.Properties;

/**
 * 系统相关信息
 */
@Getter
public class Sys {
    /**
     * 服务器名称
     */
    private final String computerName;

    /**
     * 服务器Ip
     */
    private final String computerIp;

    /**
     * 项目路径
     */
    private final String userDir;

    /**
     * 操作系统
     */
    private final String osName;

    /**
     * 系统架构
     */
    private final String osArch;

    public Sys() {
        Properties props = System.getProperties();
        this.computerName = IpUtils.getHostName();
        this.computerIp = IpUtils.getLocalIp();
        this.osName = props.getProperty("os.name");
        this.osArch = props.getProperty("os.arch");
        this.userDir = props.getProperty("user.dir");
    }
}
